package com.example.teesystem.entityDto;

import com.example.teesystem.common.cache.CourseCache;
import com.example.teesystem.entity.ExamEvaluation;
import com.example.teesystem.entity.ExamPaper;
import lombok.Data;

/**
 * @author : NieYaShi
 * @version : v1.0
 * @createTime : 2022/5/14 15:35
 */
@Data
public class ExamCondition {
    private String examPaperName;
    private Integer courseId;
    private String courseName;
    private int examPaperScore;
    private int studentScore;

    public ExamCondition(ExamPaper examPaper, ExamEvaluation examEvaluation){
        this.examPaperName = examPaper.getName();
        this.courseId = examPaper.getCourseId();
        this.courseName = CourseCache.courseMap.get(courseId).getName();
        this.examPaperScore = examPaper.getScore();

        if (examEvaluation != null) {
            this.studentScore = examEvaluation.getScore();
        }else {
            this.studentScore = 0;
        }
    }
}
